import axios from '../axios';

/** *********用户登录******** */
export const login = (fundAccount, password, vcode) => axios.post('dz-mall/r/system/login', {
  fundAccount,
  password,
  vcode,
  opStation: ''
});

/** *********用户退出登录******** */
export const logout = (fundAccount) => axios.post('dz-mall/r/system/logout', {
  fundAccount
});

/** *********获取rsa所需modulus和exponent******** */
// export const getRSAKey = () => axios.post('dz-mall/r/system/getRSAKey');

/** *********校验ticket******** */
export const authTicket = (ticket) => axios.post('dz-mall/r/system/authTicket', {
  ticket
});

/** *********获取图片验证码******** */
export const validateCode = (stamp) => axios.post('dz-mall/r/system/validCode', {
  stamp
});

/** *********获取用户信息******** */
export const getLoginUserInfo = (isLogin, { cookie }) => axios.post('dz-mall/r/system/getLoginUserInfo', {
  isLogin
}, { cookie });

/** *********获得用户资金******** */
export const getFundInfo = ({ cookie }) => axios.post('dz-mall/r/account/getFundInfo', {}, {
  cookie
});

/** *********查询用户基本信息******** */
export const getBaseInfo = () => axios.post('dz-mall/r/account/getBaseInfo');

/** *********查询用户扩展信息******** */
export const getExternalInfo = () => axios.post('dz-mall/r/account/getExternalInfo');

/** *********获取用户权限******** */
export const getUserRights = () => axios.post('dz-mall/r/account/getUserRights');

/** *********用户开通电子合同e权限******** */
export const signEContract = () => axios.post('dz-mall/r/account/signEContract');

/** *********判断用户风险等级、信息完整、身份证过期******** */
export const getUserInfoValid = () => axios.post('dz-mall/r/account/getUserInfoValid', {}, {
  loading: true
});

/** *********获取投资者投资偏好******** */
export const getInvestInfo = () => axios.post('dz-mall/r/account/getInvestInfo');

/** *********特别关注校验******** */
export const specialFocusInfo = (productCode) => axios.post('dz-mall/r/account/specialFocusInfo', {
  productCode
});
/** *********获取产品适当性信息以及匹配类型******** */
export const getProductElig = (productCode) => axios.post('dz-mall/r/account/getProductElig', {
  productCode
});

/** *********获取产品适当性信息以及匹配类型******** */
export const setProductElig = (params) => axios.postBody('dz-mall/r/account/setProductElig', {
  content: params.content,
  batchNo: params.batchNo
});

/** *********获取用户基金账户信息******** */
export const getFundAccount = (fundCompany) => axios.post('dz-mall/r/account/getFundAccount', {
  fundCompany // 非必传
});

/** *********开通用户基金帐户 目前首次购买资管产品时需要开户******** */
export const openFundAccount = (fundCompany) => axios.post('dz-mall/r/account/openFundAccount', {
  fundCompany // 非必传
});

/** *********获取用户银行账户信息******** */
export const getBankAccount = () => axios.post('dz-mall/r/account/getBankAccount');

/** *********获取用户理财账户信息******** */
export const getFinancialAccount = (ta) => axios.post('dz-mall/r/account/getFinancialAccount', {
  ta // 非必传
});
/** *********获取用户理财账户信息******** */
export const signFinanContract = (params) => axios.post('dz-mall/r/account/signFinanContract', {
  ta: params.fundCompany, // 非必须
  productCode: params.productCode // 非必须
});

/** *********开通用户理财账户******** */
export const openFinanAccount = (ta) => axios.post('dz-mall/r/account/openFinanAccount', {
  ta // 非必传
});

/** *********获取用户签署的基金电子合同******** */
export const getUserContract = (params) => axios.post('dz-mall/r/account/getUserContract', {
  // fundCompany:params.fundCompany,//非必须
  productCode: params.productCode, // 非必须
  prodType: params.productType// 非必须
});

/** *********签署的基金电子合同******** */
export const signFundContract = (params) => axios.post('dz-mall/r/account/signFundContract', {
  fundCompany: params.fundCompany, // 非必须
  productCode: params.productCode // 非必须
});

/** *********获取系统时间******** */
export const getSystemInfo = () => axios.post('dz-mall/r/system/info');

/** *********获取营业部******** */
export const getBranchName = (branchNo = '') => axios.post('dz-mall/r/system/queryBranchInfo', {
  branchNo
});

/** *********跳转网厅前保存跳转参数******** */
export const saveRedirectValue = (toUrl) => axios.post('dz-mall/r/system/saveRedirectValue', {
  toUrl
});

/** *********可转换的基金列表******** */
export const getTransTargetFunds = ({
  prodCode, prodTaNo, pageNum, pageSize
}) => axios.post('dz-mall/r/product/getTransTargetFunds', {
  prodCode, prodTaNo, pageNum, pageSize
});